package com.xhtt.modules.inspection.schedule;

import com.xhtt.common.utils.EnumUtils;
import com.xhtt.modules.inspection.enums.InspectTypeEnum;
import com.xhtt.modules.inspection.enums.LineTypeEnum;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

import java.time.LocalDateTime;

/**
 * 巡检消息
 *
 * @Date 2019/3/30 11:02
 **/
@Data
public class InsMsgEntity {

    private Integer taskStepId;

    private Integer taskId;

    /**
     * 早晚班 周巡检和月巡检为空
     */
    private Integer shiftType;

    /**
     * 任务名称
     */
    private String taskName;

    private String step;

    /**
     * 巡检时间段
     */
    private String time;

    /**
     * 巡检类型
     */
    private String inspectType;

    /**
     * 班组
     */
    private Integer teamId;

    /**
     * 执行人
     */
    private String executor;

    /**
     * 线路类型
     */
    private String lineType;

    /**
     * 设备/检查表名称
     */
    private String deviceName;

    private Integer userId;

    private LocalDateTime createTime;

    public String getInspectType() {
        if (StringUtils.isNotEmpty(this.inspectType))
        return EnumUtils.getMsgByCode(InspectTypeEnum.class, Integer.parseInt(this.inspectType)).getMsg();
        else return null;
    }

    public String getLineType() {
        if (StringUtils.isNotEmpty(this.lineType))
        return EnumUtils.getMsgByCode(LineTypeEnum.class, Integer.parseInt(this.lineType)).getMsg();
        else return null;
    }

    public InsMsgEntity() {
    }

    public InsMsgEntity(String taskName, String inspectType, String lineType, String time) {
        this.taskName = taskName;
        this.inspectType = inspectType;
        this.lineType = lineType;
        this.time = time;
    }

    public InsMsgEntity(String taskName, String executor, String deviceName) {
        this.taskName = taskName;
        this.executor = executor;
        this.deviceName = deviceName;
    }
}
